package com.example.maoem;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Ajuda extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_ajuda);
		Intent it = getIntent();
		Bundle bundle = it.getExtras();
		if (bundle != null) {
			Boolean usouCartas = bundle.getBoolean(ConstantsRoque.USOU_CARTAS);
			Integer pulos = (bundle.getInt(ConstantsRoque.PULOS_EXECUTADOS));
			if (usouCartas) {
				Button cartasButton = (Button) findViewById(R.id.button2);
				cartasButton.setVisibility(View.INVISIBLE);
			}
			if (pulos==3){
				Button pulosButton = (Button) findViewById(R.id.button1);
				pulosButton.setVisibility(View.INVISIBLE);
			}
		}
	}

	public void cartas(View v) {
		Intent it = new Intent(Ajuda.this, Cartas.class);
		Intent intent = getIntent();
		Bundle bundle = intent.getExtras();
		it.putExtras(bundle);
		startActivity(it);

	}
	
	public void pular (View v ){
		Intent intent = getIntent();
		Bundle bundle = intent.getExtras();
		
		Integer pulos = (bundle.getInt(ConstantsRoque.PULOS_EXECUTADOS))+1;
		Integer numPergunta = (bundle.getInt(ConstantsRoque.PAGINA_ATUAL))+1;
		Integer perguntaAtual = (bundle.getInt(ConstantsRoque.PERGUNTA_ATUAL))+1;
		bundle.putInt(ConstantsRoque.PAGINA_ATUAL, numPergunta);
		bundle.putInt(ConstantsRoque.PERGUNTA_ATUAL, perguntaAtual);
		bundle.putInt(ConstantsRoque.PULOS_EXECUTADOS, pulos);
		Intent it = new Intent(Ajuda.this, MainActivity.class);
		it.putExtras(bundle);
		startActivity(it);
	}

}
